﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Services;
using Contracts = ASPItalia.ModelVirtualCasting.WCF.Contracts;
using ASPItalia.ModelVirtualCasting.ObjectModel;

namespace ASPItalia.ModelVirtualCasting.WCF.Services
{
    public class ODataModelsSource
    {

        public IQueryable<Contracts.ODataCandidate> Candidates
        {
            get { return ApplicationContext.Current.Candidates.GetAll().SelectDTO<Candidate, Contracts.ODataCandidate>(); }
        }

        public IQueryable<Contracts.ODataModel> Models
        {
            get
            {
                return ApplicationContext.Current.Models.GetAll().Select(m => new Contracts.ODataModel
                {
                    ID = m.ID,
                    FirstName = m.FirstName,
                    LastName = m.LastName,
                    HairColor = m.PhysicalProfile.HairColor,
                    EyeColor = m.PhysicalProfile.EyesColor,
                    ResidenceCity = m.ResidenceCity,
                });
                //get { return ApplicationContext.Current.Models.GetAll().SelectDTO<Model, Contracts.ODataModel>(); }
            }
        }
    }
}
